package cn.lysy.xiaoruan.model;


import cn.lysy.xiaoruan.javabean.userLogin;
import cn.lysy.xiaoruan.services.UserService;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static cn.lysy.xiaoruan.ServicesAddress.ServicesAddress.SERVICES_ADDRESS;

/**
 * Created by lirun on 2017/9/29.
 */

public class UserModel {
    private Retrofit retrofit;
    public UserModel(){
        retrofit = new Retrofit.Builder()
                .baseUrl(SERVICES_ADDRESS)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call login(String telephone, String password){
        UserService userService = retrofit.create(UserService.class);
        return userService.login(telephone,password);
    }
    public Call reg(String uloginname,String uname,
                    String upassword,String check_password,
                    String utelephone,String uemail){
        UserService userService=retrofit.create(UserService.class);
        return userService.Reg(uloginname, uname, upassword, check_password, utelephone, uemail);
    }
    public Call logout(String uid){
        UserService userService = retrofit.create(UserService.class);
        return userService.logout( uid );
    }
}
